<template>
  <div>
    <el-card style="margin-bottom: 20px">
      合作商搜索:<el-input
        placeholder="请输入"
        style="width: 200px; margin: 0 20px"
        v-model="params.name"
        @change="changes"
      ></el-input>
      <el-button @click="searchFn">查询</el-button>
    </el-card>
    <el-card>
      <el-table :data="tableData">
        <el-table-column prop="id" label="序号"> </el-table-column>
        <el-table-column prop="name" label="合作商名称" width="110px">
        </el-table-column>
        <el-table-column prop="account" label="账号"> </el-table-column>
        <el-table-column prop="vmCount" label="设备数量"> </el-table-column>
        <el-table-column prop="ratio" label="分成比例"> </el-table-column>
        <el-table-column prop="contact" label="联系人"> </el-table-column>
        <el-table-column prop="mobile" label="联系电话"> </el-table-column>
        <el-table-column prop="id" label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small">重置密码</el-button>
            <el-button type="text" size="small" @click="handleClick(scope.row)"
              >查看详情</el-button
            >
            <el-button type="text" size="small" @click="deleteFn(scope.row.id)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getCommitSearch, getDeleteList } from "@/api/user";
export default {
  data() {
    return {
      tableData: [],
      params: {
        pageIndex: 1,
        pageSize: 10,
        name: "",
      },
    };
  },
  methods: {
    async searchFn() {
      this.getCommitSearch();
    },
    async getCommitSearch() {
      const res = await getCommitSearch(this.params);
      // console.log(res);
      this.tableData = res.data.currentPageRecords;
    },
    async deleteFn(id) {
      console.log(id);
      const res = await getDeleteList(this.params, id);
      console.log(res);
    },
    changes() {
      this.getCommitSearch();
    },
  },
  created() {
    this.getCommitSearch();
  },
};
</script>

<style></style>
